ifeq ($(strip $(targetbase)),linux)
ifeq ($(strip $(LINUX_LK)),TRUE)
include $(SDK_DIR)/mk/sys_km.mk
#driver
ifeq ($(USW),yes)
SDK_DRV_SRCS = $(shell find $(SDK_DIR)/driver/api  -name "*.c")
SDK_DRV_SRCS += $(shell find $(SDK_DIR)/driver/usw/src  -name "*.c")
endif
ifeq ($(ASW), yes)
SDK_DRV_SRCS += $(shell find $(SDK_DIR)/driver/asw/src -name "*.c")
endif
SDK_DRV_SRCS += $(foreach n, $(COMPATIBAL_CHIP), $(shell find $(SDK_DIR)/driver/$(n)/src  -name "*.c"))
SDK_DRV_OBJS = $(patsubst %.c,%.o,$(SDK_DRV_SRCS))
SDK_DRV_OBJS := $(subst $(SDK_DIR)/driver/,,$(SDK_DRV_OBJS))

lib-m += $(SDK_DRV_OBJS)

else

include $(MK_DIR)/sys.mk
OBJ_DIR=$(OBJ_BASE_DIR)/driver
LIB = drv
SRCS =

SRCS += $(foreach n, $(COMPATIBAL_CHIP), $(shell find $(n)/src/    -name "*.c"))

ifeq ($(USW),yes)
SRCS += $(shell find api -name "*.c")
SRCS += $(shell find usw/src/ -name "*.c")
endif
ifeq ($(ASW), yes)
SRCS += $(shell find asw/src -name "*.c")
endif

CPPFLAGS += -I$(SDK_DIR)/core/common/include
CPPFLAGS += -I$(SDK_DIR)/dal/include
CPPFLAGS += -I$(SDK_DIR)/sal/include
CPPFLAGS += -I$(SDK_DIR)/sal/utility/include

ifeq ($(strip $(BOARD)),ctc-sim)
CPPFLAGS += -I$(SDK_DIR)/../cmodel/ctckal/include
CPPFLAGS += -I$(SDK_DIR)/../cmodel/$(CHIPNAME)/include
ifeq ($(USW),yes)
CPPFLAGS += -I$(SDK_DIR)/driver/usw/include
else

ifeq (goldengate, $(filter goldengate, $(chipname)))
CPPFLAGS += -I$(SDK_DIR)/mem_model/goldengate/include
endif
ifeq (greatbelt, $(filter greatbelt, $(chipname)))
CPPFLAGS += -I$(SDK_DIR)/mem_model/greatbelt/include
CPPFLAGS += -I$(SDK_DIR)/driver/greatbelt/include
endif

endif
endif




ifeq ($(strip $(BOARD)),ctc-sim)
CPPFLAGS += -DDRVIER_WORK_PLATFORM=1
else
CPPFLAGS += -DDRVIER_WORK_PLATFORM=0
endif

ifeq ($(USW),yes)
CPPFLAGS += -I$(SDK_DIR)/driver/api
CPPFLAGS += -I$(SDK_DIR)/driver/usw/include
endif
CPPFLAGS += -I$(SDK_DIR)/driver

include $(MK_DIR)/lib.mk
endif
endif

ifeq ($(strip $(targetbase)),vxworks)

OBJ_DIR=$(OBJ_BASE_DIR)/driver

all_targets = $(COMPATIBAL_CHIP)
ifeq ($(USW),yes)
all_targets += usw api
endif
all_targets += libdrv

all: $(all_targets) FORCE
clean: $(addprefix clean_,$(all_targets)) FORCE

api: FORCE
	$(CTC_MAKE) -C $(SDK_DIR)/driver/api -f Makefile.vx

clean_api: FORCE
	$(CTC_MAKE) -C $(SDK_DIR)/driver/api -f Makefile.vx  clean	

usw: FORCE
	$(CTC_MAKE) -C $(SDK_DIR)/driver/usw/ -f Makefile.vx

clean_usw: FORCE
	$(CTC_MAKE) -C $(SDK_DIR)/driver/usw/ -f Makefile.vx  clean

goldengate: FORCE
	$(CTC_MAKE) -C $(SDK_DIR)/driver/goldengate/ -f Makefile.vx

clean_goldengate: FORCE
	$(CTC_MAKE) -C $(SDK_DIR)/driver/goldengate/ -f Makefile.vx  clean

greatbelt: FORCE
	$(CTC_MAKE) -C $(SDK_DIR)/driver/greatbelt/ -f Makefile.vx

clean_greatbelt: FORCE
	$(CTC_MAKE) -C $(SDK_DIR)/driver/greatbelt/ -f Makefile.vx clean

libdrv: FORCE
	$(CTC_MAKE) -f Makefile_libdrv.vx

clean_libdrv: FORCE
	$(CTC_MAKE) -f Makefile_libdrv.vx clean	

.PHONY: FORCE
FORCE:
endif

